package easy;

public class Solution_409 {

    public int longestPalindrome(String s) {
        int count = 0;
        char[] chars = s.toCharArray();
        int[] arr = new int[128];
        for (int i = 0; i < chars.length; i++) {
            char c = chars[i];
            arr[c]++;
        }
        for (int i : arr) {
            count = count + (i % 2 == 0 ? i : i - 1);
        }
        return count == s.length() ? count : count + 1;
    }

    public static void main(String[] args) {
        Solution_409 model = new Solution_409();
        System.out.println(model.longestPalindrome("abccccdd"));
    }
}
